<!-- List group -->
<table class="table mgt10">
  <tr>
    <th class="text-left gray-font-12">文章标题</th>
    <th class="text-right gray-font-12">阅读</th>
    <th class="text-right gray-font-12">发布时间</th>
  </tr>
  <%- if articles.size > 0 %>
      <%- articles.each do |article| %>
          <tr>
            <th class="text-left font14"><%= link_to article.title, article_path(article) %></th>
            <th class="text-right gray-font-12"><%= article.click %></th>
            <th class="text-right gray-font-12">
              <%- _current_year = Time.new.strftime("%Y") %>
              <%- _article_year = article.created_at.strftime("%Y") %>
              <%- if _current_year == _article_year %>
                <%= article.created_at.strftime("%m-%d %H:%M") %>
              <% else %>
                <%= article.created_at.strftime("%y-%m-%d") %>
              <% end %>
            </th>
          </tr>
      <%- end %>
  <%- else %>
      <tr>
        <th class="text-left font14"></th>
        <th class="text-center gray-font-12">
          还没有文章
          <%- if can? :manage, topic %>
              <%= link_to ',点击添加', new_article_topic_path(topic), 'data-no-turbolink' => true %>
          <%- end %></th>
        <th class="text-right gray-font-12"></th>
      </tr>
  <% end %>
</table>
<%= render partial: 'common/paginate', locals: {obj: articles} %>